// 柱状图绘制

function drawBar(chartId, xData, yData) {

    var myChart = echarts.init(document.getElementById(chartId));

    var option = {
        color: ['#4BE8FF'],
        legend: {
            show: true,
            textStyle: {
                color: '#E2F1FF'
            }
        },
        tooltip: {
            trigger: 'axis'
        },
        xAxis: {
            type: 'category',
            axisLabel: {
                color: "#BDE4FF"
            },
            axisTick: {
                show: false,
            },
            axisLine: {
                lineStyle: {
                    color: '#296085',
                }
            },
            data: xData
        },
        yAxis: {
            type: 'value',
            minInterval: 1,
            axisLabel: {
                color: "#BDE4FF"
            },
            splitLine: {
                lineStyle: {
                    color: '#296085',
                    type: "dashed"
                }
            }
        },
        series: [
            {
                data: yData,
                type: 'bar',
                barWidth: '13px',
                itemStyle: {
                    normal: {
                        color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                            {
                                offset: 0,
                                color: '#F3F2B5',
                            },
                            {
                                offset: 1,
                                color: '#B67E2C',
                            },
                        ]),
                        barBorderRadius: [8,8,0,0 ],
                    },
                },
            }
        ]
    };


    myChart.setOption(option);

}


// 折线图绘制

function drawLine(chartId, xData, yData) {

    var myChart = echarts.init(document.getElementById(chartId));

    var option = {
        color: ['#4BE8FF'],
        legend: {
            show: true,
            textStyle: {
                color: '#E2F1FF'
            }
        },
        tooltip: {
            trigger: 'axis'
        },
        xAxis: {
            type: 'category',
            axisLabel: {
                color: "#BDE4FF"
            },
            axisTick: {
                show: false,
            },
            axisLine: {
                lineStyle: {
                    color: '#296085',
                }
            },
            data: xData
        },
        yAxis: {
            type: 'value',
            minInterval: 1,
            axisLabel: {
                color: "#BDE4FF"
            },
            splitLine: {
                lineStyle: {
                    color: '#296085',
                    type: "dashed"
                }
            }
        },
        series: [
            {
                data: yData,
                type: 'line',
                lineStyle: {
                    shadowColor: 'rgba(20, 20, 20, 0.9)',
                    shadowBlur: 3,
                    shadowOffsetX: 3,
                    shadowOffsetY: 2,
                },
            }
        ]
    };


    myChart.setOption(option);

}